package com.mtbu.bean.base;
import java.util.*;
import java.text.SimpleDateFormat;
import org.json.JSONObject;
import my.json.core.JsonAble;
public abstract class ColumnStatiskeyMapBase implements JsonAble {
    private Map<String, Object> dirtyProperties = new HashMap<String, Object>();
    //
    private int id = 0;
    //
    private String platform = "";
    //
    private String columnName = "";
    //
    private String statiskey = "";
    //
    private int status = 0;
    public int getId(){
        return this.id;
    }
    public void setId(int id){
        this.id = id;
    }
    public String getPlatform(){
        return this.platform;
    }
    public void setPlatform(String platform){
        this.platform = platform;
        dirtyProperties.put("platform", platform);
    }
    public String getColumnName(){
        return this.columnName;
    }
    public void setColumnName(String columnName){
        this.columnName = columnName;
        dirtyProperties.put("columnName", columnName);
    }
    public String getStatiskey(){
        return this.statiskey;
    }
    public void setStatiskey(String statiskey){
        this.statiskey = statiskey;
        dirtyProperties.put("statiskey", statiskey);
    }
    public int getStatus(){
        return this.status;
    }
    public void setStatus(int status){
        this.status = status;
        dirtyProperties.put("status", status);
    }
    public Map<String, Object> getDirtyProperties() {
        return this.dirtyProperties;
    }
    public JSONObject toJSON() throws Exception {
        JSONObject json = new JSONObject();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        json.put("id", this.getId());
        if(platform!=null){
           json.put("platform",this.getPlatform());
        }
        if(columnName!=null){
           json.put("columnName",this.getColumnName());
        }
        if(statiskey!=null){
           json.put("statiskey",this.getStatiskey());
        }
        json.put("status", this.getStatus());
        return json;
    }
    public void fromJSON(JSONObject json) throws Exception {
        if(json==null) return;
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try{
            if(json.get("id") != null){
                this.setId(Integer.parseInt(json.get("id")+""));
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("platform") != null){
                this.setPlatform(json.get("platform")+"");
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("columnName") != null){
                this.setColumnName(json.get("columnName")+"");
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("statiskey") != null){
                this.setStatiskey(json.get("statiskey")+"");
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("status") != null){
                this.setStatus(Integer.parseInt(json.get("status")+""));
            }
        }catch(Exception ex){
        }
    }
    public void fromMap(Map<String, String> json) throws Exception {
        if(json==null) return;
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            if(json.containsKey("id".toLowerCase())){
                this.setId(Integer.parseInt(json.get("id".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("platform".toLowerCase())){
                this.setPlatform(json.get("platform".toLowerCase())+"");
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("columnName".toLowerCase())){
                this.setColumnName(json.get("columnName".toLowerCase())+"");
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("statiskey".toLowerCase())){
                this.setStatiskey(json.get("statiskey".toLowerCase())+"");
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("status".toLowerCase())){
                this.setStatus(Integer.parseInt(json.get("status".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
    }
}
